﻿using System;
using System.Xml.Linq;

using Perseus;

namespace Hetymine.Executioner.Commands {
    public class CommandInfo {
        public CommandInfo() : this(string.Empty, string.Empty) { }
        public CommandInfo(string command) : this(command, string.Empty) { }
        public CommandInfo(string command, string args) {
            this.Command = command;
            this.Arguments = args;
        }
        public CommandInfo(XElement element) {
            if (element == null) {
                this.Command = string.Empty;
                this.Arguments = string.Empty;
            }
            else {
                this.Command = element.Value;
                if (element.Attribute("Args") != null) {
                    this.Arguments = element.Attribute("Args").Value;
                }
                else {
                    this.Arguments = string.Empty;
                }
            }
        }
        public string Command { get; set; }
        public string Arguments { get; set; }

        public bool IsEmpty {
            get {
                return (this.Command.IsEmpty());
            }
        }
    }
}
